import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const router = new VueRouter({
  routes: [

    {
      path: '/jiaohu/pie',
      name: '饼图',
      meta:{
        title:"饼图"
      },
      component: () => import('../views/jiaohu/Pie.vue')
    },

    {
      path: '/jiaohu/bar',
      name: '柱状图和折线图切换',
      meta:{
        title:"柱状图和折线图切换"
      },
      component: () => import('../views/jiaohu/Bar.vue')
    },
    {
      path: '/jiaohu/echarts',
      name: '交互echarts三图切换及下载',
      meta:{
        title:"交互echarts三图切换及下载"
      },
      component: () => import('../views/jiaohu/Echarts.vue')
    },
    {
      path:'/jingtai/searchOne',
      name:'纯前端实现查询方法一',
      meta:{
        title:"纯前端实现查询方法一"
      },
      component: () => import('../views/chunVueSearch/searchOne')
    },
    {
      path:'/jingtai/searchTwo',
      name:'纯前端实现查询方法二',
      meta:{
        title:"纯前端实现查询方法二"
      },
      component: () => import('../views/chunVueSearch/searchTwo')
    },
    {
      path: '/',
      name: '卡片',
      meta:{
        title:"卡片",
        permission: 'isAuthenticated',
      },
      component: () => import('../views/element/carousel')
    },
  ],
  mode: 'history',  //去掉url后面的"#/"
})

router.afterEach((to, from) => {
  document.title = to.meta.title //在全局后置守卫中获取路由元信息设置title
})


export default router
